<template>
    <p class="time">{{ currentTime }}</p>
</template>
<script>

export default {
    data() {
        return {
            currentTime:""
        }
    },
    mounted(){
        setInterval(() =>{
            var time = new Date();
            var y = time.getFullYear();
            var mh = time.getMonth() + 1;
            var d = time.getDate();
            var nday = time.getDay();
            var h = time.getHours();
            h = h < 10 ? '0' + h : h;
            var m = time.getMinutes();
            m = m < 10 ? '0' + m : m;
            var s = time.getSeconds();
            s = s < 10 ? '0' + s : s;
            this.currentTime = y + '年' + mh + '月' + d + '日' +' ' + h + ':' + m + ':' + s;
        },1000)
    }
}

</script>
<style scoped>
.time {
    color: #39FCFF;
    /* float: right; */
    margin-top: -17px;
}
</style>